# 添加的.c文件
SRCS = $(wildcard *.c) 
OBJS = $(SRCS:.c = .o)

# 指定 头文件目录
INCLUDES = -I .

# 指定库目录
LIBS = -L.

# 指定编译器
CC = gcc
# 指定编译选项
CCFLAGS = -g -Wall -O0

# 编译目标列表
OUTPUT1 = read
OUTPUT2 = creat
# ...
OUTPUTLIST=$(OUTPUT1) $(OUTPUT2)

#make all target
all : $(OUTPUTLIST)


$(OUTPUT1) : $(OBJS)
	@$(CC) $^ -o $@ $(INCLUDES) $(LIBS) -D_$(shell echo $(@)|tr a-z A-Z)_

$(OUTPUT2) : $(OBJS)
	@$(CC) $^ -o $@ $(INCLUDES) $(LIBS) -D_$(shell echo $(@)|tr a-z A-Z)_

%.o : %.c
	@$(CC) -c $< $(CCFLAGS)

clean:
	@rm $(OUTPUTLIST)
.PHONY:clean
